<template>
  <div>
    <div class="header">
      <div class="header_left">
        <img src="/img/index_icon/logo.png" alt="" />
      </div>
      <div class="header_right">
        <template v-if="islogin == null">
          <router-link to="/login" class="login">登录</router-link>
          <router-link to="/register" href="javascript:;" class="register"
            >注册</router-link
          ></template
        >
        <template v-else>
          <span>欢迎：{{ unickname }}</span>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
// 根据state中的uname的值null显示登录注册，不是null显示用户名
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["islogin", "unickname"]),
  },
};
</script>
<style scoped src="../assets/css/header.css"></style>
<style lang="scss" scoped></style>
